package org.shiro.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.shiro.basic.entity.SystemUser;
import org.shiro.service.ResourceService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 相关系统资源网络接口
 *
 * @author LiKun
 * @date 2021/11/3 14:43
 */
@RestController
@RequestMapping("/resource")
@Api(tags = "系统资源相关网络接口")
public class ResourceController {
    @Resource
    private ResourceService resourceService;

    @RequiresAuthentication
    @ApiOperation("获取用户数据信息")
    @GetMapping("/userInfo/{userId}")
    public SystemUser getUserInfo(@PathVariable("userId") String userId) throws JsonProcessingException {
        return resourceService.getUserInfo(userId);
    }
}
